<?php

namespace Drupal\ssy_live_room\Entity;

class SsyLiveRoom extends \Entity {

  public $id;

  public $vid;

  public $uid;

  public $op_uid;

  public $created;

  public $changed;

  public $is_new_revision;

  public $name;

  public $cover_img;

  public $start_time = REQUEST_TIME + (60 * 60);

  public $end_time = REQUEST_TIME + (3 * 60 * 60);

  public $anchor_name;

  public $anchor_wechat;

  public $sub_anchor_wechat;

  public $creater_wechat;

  public $share_img;

  public $feeds_img;

  public $is_feeds_public = 1;

  public $type = 0;

  public $close_like = 0;

  public $close_goods = 0;

  public $close_comment = 0;

  public $close_replay = 0;

  public $close_share = 0;

  public $close_kf = 0;

  public $room_id = 0;

  public $qrcode_url;

  public $live_status = 0;

  public $anchor_id;

  function __construct($values = []) {
    $this->is_new_revision = TRUE;
    parent::__construct($values, 'ssy_live_room');
  }

  public function save() {
    $this->changed = REQUEST_TIME;
    if (empty($this->created)) {
      $this->created = REQUEST_TIME;
    }

    $this->op_uid = $GLOBALS['user']->uid;
    if (empty($this->uid)) {
      $this->uid = $GLOBALS['user']->uid;
    }

    return parent::save();
  }

}
